package me.hellp.helloworld.design.observerjdk;

import java.util.Observable;
import java.util.Observer;

public class NormalUserJdk implements Observer{
	private String userName;
	
	public NormalUserJdk(String name){
		this.userName = name;
	}
	
	@Override
	public void update(Observable o, Object arg) {
        if(o instanceof WebChatJdk){  
        	WebChatJdk webChat = (WebChatJdk)o;
        	read(webChat.getMessage());
        }  
	}

    public void read(String msg) {
        System.out.println(userName + " 收到推送消息： " + msg);
    }
}
